x86/altp2m: fix HVMOP_altp2m_set_domain_state race
authorRazvan Cojocaru <rcojocaru@bitdefender.com>
Mon, 18 Feb 2019 12:46:02 +0000 (13:46 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 18 Feb 2019 12:46:02 +0000 (13:46 +0100)
commit24d5282527f4647907b3572820b5335c15cd0356
treef558a34cd1b40cc29f195c25e569d67eaa8dd9a9
parent29d28b29190ba09d53ae7e475108def84e16e363
x86/altp2m: fix HVMOP_altp2m_set_domain_state race

HVMOP_altp2m_set_domain_state does not domain_pause(), presumably
on purpose (as it was originally supposed to cater to a in-guest
agent, and a domain pausing itself is not a good idea).

This can lead to domain crashes in the vmx_vmexit_handler() code
that checks if the guest has the ability to switch EPTP without an
exit. That code can __vmread() the host p2m's EPT_POINTER
(before HVMOP_altp2m_set_domain_state "for_each_vcpu()" has a
chance to run altp2m_vcpu_initialise(), but after
d->arch.altp2m_active is set).

Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/hvm/hvm.c